home *** CD-ROM | disk | FTP | other *** search
/ BCI NET 2 / BCI NET 2.iso / archives / programming / languages / obrn-a_1.5_lib.lha / oberon-a / source1.lha / source / amiga / Config.mod < prev    next >
Encoding:
Text File  |  1995-01-26  |  12.5 KB  |  357 lines

  1. (***************************************************************************
  2.  
  3.      $RCSfile: Config.mod $
  4.   Description: Interface to expansion.library
  5.  
  6.    Created by: fjc (Frank Copeland)
  7.     $Revision: 3.7 $
  8.       $Author: fjc $
  9.         $Date: 1995/01/26 02:39:55 $
  10.  
  11.   Includes Release 40.15
  12.  
  13.   (C) Copyright 1985-1993 Commodore-Amiga, Inc.
  14.       All Rights Reserved
  15.  
  16.   Oberon-A interface Copyright © 1994-1995, Frank Copeland.
  17.   This file is part of the Oberon-A Interface.
  18.   See Oberon-A.doc for conditions of use and distribution.
  19.  
  20. ***************************************************************************)
  21.  
  22. <* STANDARD- *> <* INITIALISE- *> <* MAIN- *>
  23. <*$ CaseChk-  IndexChk- LongVars+ NilChk-  *>
  24. <*$ RangeChk- StackChk- TypeChk-  OvflChk- *>
  25.  
  26. MODULE [2] Config;
  27.  
  28. IMPORT e := Exec, s := Sets;
  29.  
  30. (*
  31. **      $VER: configregs.h 36.13 (15.2.91)
  32. **
  33. **      AutoConfig (tm) hardware register and bit definitions
  34. *)
  35.  
  36.  
  37. (*
  38. ** AutoConfig (tm) boards each contain a 32 byte "ExpansionRom" area that is
  39. ** read by the system software at configuration time.  Configuration of each
  40. ** board starts when the ConfigIn* signal is passed from the previous board
  41. ** (or from the system for the first board).  Each board will present it's
  42. ** ExpansionRom structure at location $00E80000 to be read by the system.
  43. ** This file defines the appearance of the ExpansionRom area.
  44. **
  45. ** Expansion boards are actually organized such that only one nybble per
  46. ** 16 bit word contains valid information.  The low nybbles of each
  47. ** word are combined to fill the structure below. (This table is structured
  48. ** as LOGICAL information.  This means that it never corresponds exactly
  49. ** with a physical implementation.)
  50. **
  51. ** The ExpansionRom space is further split into two regions:  The first 16
  52. ** bytes are read-only.  Except for the ertype field, this area is inverted
  53. ** by the system software when read in.  The second 16 bytes contain the
  54. ** control portion, where all read/write registers are located.
  55. **
  56. ** The system builds one "ConfigDev" structure for each board found.  The
  57. ** list of boards can be examined using the expansion.library/FindConfigDev
  58. ** function.
  59. **
  60. ** A special "hacker" Manufacturer ID number is reserved for test use:
  61. ** 2011 ($7DB).  When inverted this will look like $F824.
  62. *)
  63.  
  64. TYPE
  65.  
  66.   ExpansionRomPtr * = POINTER TO ExpansionRom;
  67.   ExpansionRom * = RECORD
  68.     type *         : SHORTINT; (* Board type, size and flags *)
  69.     product *      : SHORTINT; (* Product number, assigned by manufacturer *)
  70.     flags *        : s.SET8;   (* Flags *)
  71.     reserved03 *   : SHORTINT; (* Must be zero ($ff inverted) *)
  72.     manufacturer * : e.UWORD;  (* Unique ID,ASSIGNED BY COMMODORE-AMIGA! *)
  73.     serialNumber * : e.ULONG;  (* Available for use by manufacturer *)
  74.     initDiagVec *  : e.UWORD;  (* Offset to optional "DiagArea" structure *)
  75.     reserved0c *   : SHORTINT;
  76.     reserved0d *   : SHORTINT;
  77.     reserved0e *   : SHORTINT;
  78.     reserved0f *   : SHORTINT;
  79.   END; (* ExpansionRom *)
  80.  
  81.  
  82. (*
  83. ** Note that use of the ecBaseAddress register is tricky.  The system
  84. ** will actually write twice.  First the low order nybble is written
  85. ** to the ecBaseAddress register+2 (D15-D12).  Then the entire byte is
  86. ** written to ecBaseAddress (D15-D8).  This allows writing of a byte-wide
  87. ** address to nybble size registers.
  88. *)
  89.  
  90. TYPE
  91.  
  92.   ExpansionControlPtr * = POINTER TO ExpansionControl;
  93.   ExpansionControl * = RECORD
  94.     interrupt *   : SHORTINT; (* Optional interrupt control register *)
  95.     z3HighBase *  : SHORTINT; (* Zorro III   : Config address bits 24-31 *)
  96.     baseAddress * : SHORTINT; (* Zorro II/III: Config address bits 16-23 *)
  97.     shutup *      : SHORTINT; (* The system writes here to shut up a board *)
  98.     reserved14 *  : SHORTINT;
  99.     reserved15 *  : SHORTINT;
  100.     reserved16 *  : SHORTINT;
  101.     reserved17 *  : SHORTINT;
  102.     reserved18 *  : SHORTINT;
  103.     reserved19 *  : SHORTINT;
  104.     reserved1a *  : SHORTINT;
  105.     reserved1b *  : SHORTINT;
  106.     reserved1c *  : SHORTINT;
  107.     reserved1d *  : SHORTINT;
  108.     reserved1e *  : SHORTINT;
  109.     reserved1f *  : SHORTINT;
  110.   END; (* ExpansionControl *)
  111.  
  112. (*
  113. ** many of the constants below consist of a triplet of equivalent
  114. ** definitions: xxMASK is a bit mask of those bits that matter.
  115. ** xxBIT is the starting bit number of the field.  xxSIZE is the
  116. ** number of bits that make up the definition.  This method is
  117. ** used when the field is larger than one bit.
  118. **
  119. ** If the field is only one bit wide then the xxBxx and xxFxx convention
  120. ** is used (xxBxx is the bit number, and xxFxx is mask of the bit).
  121. *)
  122.  
  123. CONST
  124.  
  125. (* manifest constants *)
  126.   slotSize *              = 10000H;
  127.   slotMask *              = 0FFFFH;
  128.   slotShift *             = 16;
  129.  
  130. (* these define the free regions of Zorro memory space.
  131. ** THESE MAY WELL CHANGE FOR FUTURE PRODUCTS!
  132. *)
  133.  
  134.   eExpansionBase *         = 00E80000H;      (* Zorro II  config address *)
  135.   eZ3ExpansionBase *       = 0FF000000H;     (* Zorro III config address *)
  136.  
  137.   eExpansionSize *         = 00080000H;      (* Zorro II  I/O type cards *)
  138.   eExpansionSlots *        = 8;
  139.  
  140.   eMemoryBase *            = 00200000H;      (* Zorro II  8MB space *)
  141.   eMemorySize *            = 00800000H;
  142.   eMemorySlots *           = 128;
  143.  
  144.   eZ3ConfigArea *          = 40000000H;      (* Zorro III space *)
  145.   eZ3ConfigAreaEnd *       = 7FFFFFFFH;      (* Zorro III space *)
  146.   eZ3SizeGranularity *     = 00080000H;      (* 512K increments *)
  147.  
  148.  
  149.  
  150. (**** erType definitions (ttldcmmm) ***************************************)
  151.  
  152. CONST
  153.  
  154. (* erType board type bits -- the OS ignores "old style" boards *)
  155.   ertTypeMask *            = -64;     (* Bits 7-6 *)
  156.   ertTypeBit *             = 6;
  157.   ertTypeSize *            = 2;
  158.   ertNewBoard *            = -64;
  159.   ertZorroII *             = ertNewBoard;
  160.   ertZorroIII *            = -128;
  161.  
  162. (* other bits defined in erType *)
  163.   ertbMemList *            = 5;   (* Link RAM into free memory list *)
  164.   ertbDiagValid *          = 4;   (* ROM vector is valid *)
  165.   ertbChainedConfig *      = 3;   (* Next config is part of the same card *)
  166.  
  167.   ertfMemList *            = 20H;
  168.   ertfDiagValid *          = 10H;
  169.   ertfChainedConfig *      = 08H;
  170.  
  171. (* erType field memory size bits *)
  172.   ertMemMask *             = 07H;    (* Bits 2-0 *)
  173.   ertMemBit *              = 0;
  174.   ertMemSize *             = 3;
  175.  
  176.  
  177. (**** erFlags byte -- for those things that didn't fit into the type byte ****)
  178. (**** the hardware stores this byte in inverted form                       ****)
  179.  
  180. CONST
  181.  
  182.   erffMemSpace       * = -128;   (* Wants to be in 8 meg space. *)
  183.   erfbMemSpace       * = 7;      (* (NOT IMPLEMENTED) *)
  184.  
  185.   erffNoShutUp       * = 64;     (* Board can't be shut up *)
  186.   erfbNOShutUP       * = 6;
  187.  
  188.   erffExtended       * = 32;     (* Zorro III: Use extended size table *)
  189.   erfbExtended       * = 5;      (*            for bits 0-2 of er_Type *)
  190.                                  (* Zorro II : Must be 0 *)
  191.  
  192.   erffZorroIII       * = 16;     (* Zorro III: must be 1 *)
  193.   erfbZorroIII       * = 4;      (* Zorro II : must be 0 *)
  194.  
  195.  
  196.   ertZ3SSMask        * = 0FH;    (* Bits 3-0.  Zorro III Sub-Size.  How *)
  197.   ertZ3SSBit         * = 0;      (* much space the card actually uses   *)
  198.   ertZ3SSSize        * = 4;      (* (regardless of config granularity)  *)
  199.                                  (* Zorro II : must be 0        *)
  200.  
  201.  
  202. (* ecInterrupt register (unused) ********************************************)
  203.  
  204. CONST
  205.   ecibINTENA         * = 1;
  206.   ecibRESET          * = 3;
  207.   ecibINT2PEND       * = 4;
  208.   ecibINT6PEND       * = 5;
  209.   ecibINT7PEND       * = 6;
  210.   ecibINTERRUPTING   * = 7;
  211.  
  212.   ecifINTENA         * = 2;
  213.   ecifRESET          * = 8;
  214.   ecifINT2PEND       * = 16;
  215.   ecifINT6PEND       * = 32;
  216.   ecifINT7PEND       * = 64;
  217.   ecifINTERRUPTING   * = -128;
  218.  
  219.  
  220. (***************************************************************************
  221. **
  222. ** these are the specifications for the diagnostic area.  If the Diagnostic
  223. ** Address Valid bit is set in the Board Type byte (the first byte in
  224. ** expansion space) then the Diag Init vector contains a valid offset.
  225. **
  226. ** The Diag Init vector is actually a word offset from the base of the
  227. ** board.  The resulting address points to the base of the DiagArea
  228. ** structure.  The structure may be physically implemented either four,
  229. ** eight, or sixteen bits wide.  The code will be copied out into
  230. ** ram first before being called.
  231. **
  232. ** The daSize field, and both code offsets (daDiagPoint and daBootPoint)
  233. ** are offsets from the diag area AFTER it has been copied into ram, and
  234. ** "de-nibbleized" (if needed).  (In other words, the size is the size of
  235. ** the actual information, not how much address space is required to
  236. ** store it.)
  237. **
  238. ** All bits are encoded with uninverted logic (e.g. 5 volts on the bus
  239. ** is a logic one).
  240. **
  241. ** If your board is to make use of the boot facility then it must leave
  242. ** its config area available even after it has been configured.  Your
  243. ** boot vector will be called AFTER your board's final address has been
  244. ** set.
  245. **
  246. ****************************************************************************)
  247.  
  248. TYPE
  249.  
  250.   DiagAreaPtr * = POINTER TO DiagArea;
  251.   DiagArea * = RECORD
  252.     config *     : e.UBYTE; (* see below for definitions *)
  253.     flags *      : s.SET8;  (* see below for definitions *)
  254.     size *       : e.UWORD; (* the size (in bytes) of the total diag area *)
  255.     diagPoint *  : e.UWORD; (* where to start for diagnostics, or zero *)
  256.     bootPoint *  : e.UWORD; (* where to start for booting *)
  257.     name *       : e.UWORD; (* offset in diag area where a string *)
  258.                             (*   identifier can be found (or zero if no *)
  259.                             (*   identifier is present). *)
  260.  
  261.     reserved01 * : e.UWORD; (* two words of reserved data.  must be zero. *)
  262.     reserved02 * : e.UWORD;
  263.   END; (* DiagArea *)
  264.  
  265. (* daConfig definitions *)
  266. (*
  267. ** dacByteWide can be simulated using dacNibbleWide.
  268. *)
  269.  
  270. CONST
  271.  
  272.   dacBusWidth *    = 0C0X; (* two bits for bus width *)
  273.   dacNibbleWide *  = 00X;
  274.   dacByteWide *    = 40X; (* BUG: Will not work under V34 Kickstart! *)
  275.   dacWordWide *    = 80X;
  276.  
  277.   dacBootTime *    = 30X;    (* two bits for when to boot *)
  278.   dacNever *       = 00X;    (* obvious *)
  279.   dacConfigTime *  = 10X;    (* call daBootPoint when first configing *)
  280.                                 (*   the device *)
  281.   dacBindTime *    = 20X;    (* run when binding drivers to boards *)
  282.  
  283. (*
  284. **
  285. ** These are the calling conventions for the diagnostic callback
  286. ** (from daDiagPoint):
  287. **
  288. ** A7 -- points to at least 2K of stack
  289. ** A6 -- ExecBase
  290. ** A5 -- ExpansionBase
  291. ** A3 -- your board's ConfigDev structure
  292. ** A2 -- Base of diag/init area that was copied
  293. ** A0 -- Base of your board
  294. **
  295. ** Your board must return a value in D0.  If this value is NULL, then
  296. ** the diag/init area that was copied in will be returned to the free
  297. ** memory pool.
  298. *)
  299.  
  300.  
  301. (*
  302. **      $VER: configvars.h 36.14 (22.4.91)
  303. **
  304. **      Software structures used by AutoConfig (tm) boards
  305. *)
  306.  
  307.  
  308. (*
  309. ** At early system startup time, one ConfigDev structure is created for
  310. ** each board found in the system.  Software may seach for ConfigDev
  311. ** structures by vendor & product ID number.  For debugging and diagnostic
  312. ** use, the entire list can be accessed.  See the expansion.library document
  313. ** for more information.
  314. *)
  315.  
  316. TYPE
  317.  
  318.   ConfigDevPtr * = POINTER TO ConfigDev;
  319.   ConfigDev * = RECORD (e.NodeBase)
  320.     node *      : e.Node;
  321.     flags *     : s.SET8;             (* (read/write) *)
  322.     pad         : e.UBYTE;            (* reserved *)
  323.     rom *       : ExpansionRom;       (* copy of board's expansion ROM *)
  324.     boardAddr * : e.APTR;             (* where in memory the board was placed *)
  325.     boardSize * : e.ULONG;            (* size of board in bytes *)
  326.     slotAddr    : e.UWORD;            (* which slot number (PRIVATE) *)
  327.     slotSize    : e.UWORD;            (* number of slots (PRIVATE) *)
  328.     driver *    : e.APTR;             (* pointer to node of driver *)
  329.     nextCD *    : ConfigDevPtr;       (* linked list of drivers to config *)
  330.     unused      : ARRAY 4 OF e.ULONG; (* for whatever the driver wants *)
  331.   END; (* ConfigDev *)
  332.  
  333. CONST
  334.  
  335. (* cdFlags *)
  336.   cdShutup *      = 0;       (* this board has been shut up *)
  337.   cdConfigMe *    = 1;       (* this board needs a driver to claim it *)
  338.   cdBadMemory *   = 2;       (* this board contains bad memory *)
  339.  
  340.  
  341. (*
  342. ** Boards are usually "bound" to software drivers.
  343. ** This structure is used by GetCurrentBinding() and SetCurrentBinding()
  344. *)
  345.  
  346. TYPE
  347.  
  348.   CurrentBindingPtr * = POINTER TO CurrentBinding;
  349.   CurrentBinding * = RECORD
  350.     configDev *     : ConfigDevPtr; (* first configdev in chain *)
  351.     fileName *      : e.LSTRPTR;    (* file name of driver *)
  352.     productString * : e.LSTRPTR;    (* product # string *)
  353.     toolTypes *     : e.APTR;       (* tooltypes from disk object *)
  354.   END; (* CurrentBinding *)
  355.  
  356. END Config.
  357.